﻿@inherits AdminCompontentBase

<DefaultSheetDialog @bind-Value=_visible Title="@T("Add Team")">
    <MStepper Value="_step" Elevation=0 Style="height: calc(100% - 40px) !important;">
        <MStepperHeader Class="mx-6" Style="box-shadow:none !important">
            <MStepperStep Step="1" Complete="_step>1">
                @T("Fill the basic team information")
            </MStepperStep>
            <MDivider></MDivider>
            <MStepperStep Step="2" Complete="_step>2">
                @T("Setup team admins")
            </MStepperStep>
            <MDivider></MDivider>
            <MStepperStep Step="3">
                @T("Setup team members")
            </MStepperStep>
        </MStepperHeader>
        <MStepperItems Class="flex-grow-1">
            <MStepperContent class="full-height" Step="1">
                <MCard Class="mx-auto d-flex flex-column full-height">
                    <TeamBasicInfo @bind-Value="_teamDetailDto.TeamBasicInfo" />
                </MCard>
            </MStepperContent>
            <MStepperContent class="full-height" Step="2">
                <MCard Class="mx-auto d-flex flex-column full-height">
                    <TeamAdmin IgnoreStaffIds="_teamDetailDto.TeamMember.Staffs" @bind-Value="_teamDetailDto.TeamAdmin" />
                </MCard>
            </MStepperContent>
            <MStepperContent class="full-height" Step="3">
                <MCard Class="mx-auto d-flex flex-column full-height">
                    <TeamMember IgnoreStaffIds="_teamDetailDto.TeamAdmin.Staffs" @bind-Value="_teamDetailDto.TeamMember" />
                </MCard>
            </MStepperContent>
        </MStepperItems>
    </MStepper>
    <MCardActions class="d-flex justify-end px-6">
        @if (_step > 1)
        {
            <SButton Medium Outlined Class="mr-4" OnClick="()=> _step-- ">@T("Previous step")</SButton>
        }
        @if (_step < 3)
        {
            <SButton Medium Disabled="@string.IsNullOrWhiteSpace(_teamDetailDto.TeamBasicInfo.Name)" OnClick="()=>{ _step++; }">@T("Next step")</SButton>
        }
        @if (_step == 3)
        {
            <SButton Medium OnClick="OnSubmitHandler">@T("Submit")</SButton>
        }
    </MCardActions>
</DefaultSheetDialog>